package game;

import java.awt.Color;
import java.awt.Rectangle;
import java.io.Serializable;

public class GameRectangle extends Rectangle implements Serializable{
	public static final long serialVersionUID = 1L;
	protected Color color;
	protected float xMotion;
	protected int prevX;
	protected int prevY;
	protected float downMotion;
	protected transient Level level;
	
	public GameRectangle(){}
	
	public GameRectangle(Level c, int x, int y, int w, int h){
		super(x, y, w, h);
		level = c;
		color = Color.black;
	}
	
	public GameRectangle(Level g, int x, int y, int w, int h, Color c){
		super(x, y, w, h);
		color = c;
		level = g;
	}
	
	public Color getColor(){
		return color;
	}
	
	public void setColor(Color c){
		color = c;
	}
	
	public void draw(){
		if(level != null){
			level.canvas.bufGraphics.setColor(color);
			level.canvas.bufGraphics.fillRect(x-level.canvas.currentX, y-level.canvas.currentY, width, height);
		}
	}
	
	public void setLevel(Level l){
		level = l;
	}
	
	public int xMotion(){
		return x-prevX;
	}
	
	public int downMotion(){
		return y-prevY;
	}
	
	public void update(){
		prevX = x;
		prevY = y;
	}
	
	public void calculateIntersectEffects(GameRectangle rect){};
	
	public void rightHit(GameRectangle g){}
	
	public void leftHit(GameRectangle g){}
	
	public void topHit(GameRectangle g){}
	
	public void bottomHit(GameRectangle g){}
}
